package com.zoe.onelink.core.util.http.model;

import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;
import java.util.Map;

/**
 * <p>标题: </p>
 * <p>描述: </p>
 * <p>版权: Copyright (c) 2022</p>
 * <p>公司: 智业软件股份有限公司</p>
 *
 * @version: 1.0
 * @author: ruansheng
 * @date: 2022-05-19
 */
@Data
@Accessors(chain = true)
public class HttpClientResponse<R> {

    private Integer statusCode;

    private R data;

    private Map<String, List<String>> headerMap;

    private Throwable exception;

    public boolean isSuccess() {
        return statusCode != null && statusCode >= 200 && statusCode < 300;
    }

    public HttpClientResponse() {
    }

    public HttpClientResponse(R data) {
        this.data = data;
    }
}
